home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 7.5 KB | 195 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: DA.Lib
- #
- # Contains: xxx put contents here xxx
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.8+> 11/19/93 NAGA modify TCS format
- # <1.0.8> 9/23/93 KTA ScrapBook() -Changed calls to launchTwitch so they twitch but do
- # not launch the previousApp.
- # <1.0.7> 8/25/93 KTA Added support for parity checking the TCS stack.
- # <1.0.6> 8/4/93 KTA ScrapBook() - Match of the window wasn't using gScrapTitle.
- # <1.0.5> 7/30/93 KTA ScrapBook() - updates so when scrapbook doesn't have enough
- # memory to launch it will be handled as expected failure.
- # <1.0.4> 7/14/93 KTA Changes for international support
- # <1.0.3> 7/6/93 KTA Change a couple of Println's to LogStr's
- # <1+> 5/21/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib","TCS.Lib","LaunchQuit.Lib","TargetCheck.Lib","UserInterface.Lib";
-
- #########################################################################
- # Scrapbook(requestElement,ccpFlag,pasteFlag)
- #========================================================================
- # Author: KTA
- # Description: This routine will select the scrapbook, scroll to the
- # designated requestElement position, select Cut, Copy, Paste,
- # or Clear from the Edit menu, close the scrapbook if under System
- # 6.0.x, and then select Paste if the pasteFlag parameter is 1.
- # Parameters: requestElement - the element in the scrapbook to scroll to
- # ccpFlag - 1 for copy
- # 2 for cut
- # 3 for paste
- # 4 for clear
- # pasteFlag - 1 to paste after closing Scrapbook
- # 0 not to paste after closing Scrapbook
- # Returns: 0 - Couldn't complete operation
- # element - Scrapbook element that operation took place on
- # Examples: Scrapbook(2) will scroll the horizontal bar to the
- # second entry and then copy, close and paste.
- # Assumptions: That the scrollbars are present. That the string
- # 'Scrapbook' appear somewhere in the name
- #========================================================================
- # History:
- # KTA 7/7/93 Made the title of the scrapbook a global, changed references to it.
- # changed cut, copy, paste, clear to be referenced by ordinality
- # final paste into app is KeyEq('v'); (all changes to support intl)
- # KTA 8/4/93 Match of the window wasn't using gScrapTitle
- # KTA 8/24/93 TCS stack parity check
- # KTA 9/23/93 Changed calls to launchTwitch so they twitch but do not launch the previousApp.
- #########################################################################
- TASK Scrapbook(requestElement,ccpFlag := 1,pasteFlag := 1)
- begin
- Global gPrevAppTitle,gIntegration,kScrapTEXT,kScrapPICT,gAppTitle, gScrapTitle;
- temp := gIntegration;
- Integration := 0; #To turn off global Integration - KTA
- tempgBackgroundQuit:= global gBackgroundQuit;
- gBackgroundQuit:= 0;
- tempgForceQuit:= global gForceQuit;
- gForceQuit:= 0;
- tempgFillMemory:= global gFillMemory;
- gFillMemory:= 0;
- LogStr( "==========================================================");
- LogStr("Performing Scrapbook DA test.");
- returnval:=0;
- failStr := '';
- ScrapDescriptor := '';
- if(requestElement = kScrapPICT)
- TCSNUM := 1;
- else if(requestElement = kScrapTEXT)
- TCSNUM := 2;
- else
- TCSNUM := 3;
-
- TCSStart({ TCSNUM, global kTCSetScrapBook }, 'ScrapBook');
- if not(gAppTitle)
- MatchApplication(0);
- If(LaunchTwitch(gScrapTitle,,0,0))
- begin
- LogStr("Opened the Scrapbook");
- scBook := match [window t:gScrapTitle o:1]!;
- if(scBook.k[1].t = 'Play Sound') #put in fix for 7.0ß4 where sound button is control [1]
- SkrollBar := scBook.k[2];
- else
- SkrollBar := scBook.k[1];
- status := SkrollBar.s;
- if (status <> { 0, -1 })
- begin # if scrollbar is enabled...
- error := 0; # no errors yet
- elementCount := status[2] + 1; # elementCount = number of scrapbook elements
- currentElement := status[1] + 1; # currentElement = current position in Scrapbook
- newCount := elementCount + 1;
-
- if (requestElement>elementCount) begin # if position is greater than total elements in Scrapbook..
- if (ccpFlag = 1)
- LogStr("!@#$% Scrapbook entry {requestElement} does not exist! - Copying entry {currentElement} of {elementCount}");
- else if (ccpFlag = 3)
- LogStr("!@#$% Scrapbook entry {requestElement} does not exist! - Pasting to entry {currentElement} of {newCount}");
- else begin
- LogStr("!@#$% Can∂'t Cut/Clear - Scrapbook entry {requestElement} does not exist! Closing Scrapbook!");
- error := 1; # don't clear or cut if requested item not there
- end;
- end;
- else begin# we've got a valid Scrapbook entry
- scroll SkrollBar a:{requestElement,elementCount};
- match [scrollbar s:?status]!;
- currentElement := status[1] + 1; # currentElement = current position in Scrapbook
- LogStr("Scrolled to item {currentElement} of {elementCount} of the ScrapBook");
- wait(1);
- end;
-
- if (not error) begin
- if (ccpFlag = 1) begin # Copy Item
- if not( SelectMenuItem(4, 3)) # error - couldn't copy
- error := 1; # prepare to abort
- end;
- else if (ccpFlag = 2) begin
- if (not SelectMenuItem(3, 3)) # error - couldn't cut
- error := 1; # prepare to abort
- end;
- else if (ccpFlag = 3) begin
- if (not SelectMenuItem(5, 3)) # error - couldn't cut
- error := 1; # prepare to abort
- else
- LogStr("Pasted to entry {currentElement} of {newCount}");
- end;
- else if (ccpFlag = 4) begin
- if (not SelectMenuItem(6, 3)) # error - couldn't clear
- error := 1; # prepare to abort
- end;
- end;
- wait(2);
- LaunchTwitch(gPrevAppTitle,,0); # Twitch to it but don't launch it
-
- if not (error)
- begin
- if (pasteFlag) begin # if we're supposed to paste back into document, do it
- wait(3);
- if (keyEq('v'))
- begin
- LogStr("==========================================================");
- returnval:=1;
- end;
- end;
- returnval:= currentElement; # everything went OK
- end; # if not (error)
- end; # if scrollbar is enabled...
- else begin
- failStr := '!@#$% The horizontal scroll bar was not enabled to scroll';
- LogStr(failStr);
- closeWindow();
- end;
- end; # If(LaunchTwitch('Scrapbook'))
- else begin
- scrapReturn := -1; # couldn't launch is an expected failure
- LaunchTwitch(gPrevAppTitle,,0); # Twitch to it but don't launch it
- failStr := "Couldn't launch the Scrapbook";
- end;
-
- if (returnVal) # Return pass or fail
- begin
- ScrapReturn := 1;
- ScrapDescriptor := returnVal;
- end;
- else
- begin
- if not(scrapReturn = -1) # Couldn't launch
- ScrapReturn := 0;
- end;
-
- TCSEnd({ TCSNUM, global kTCSetScrapBook }, ScrapReturn,failStr,,ScrapDescriptor); # End TCS
- gBackgroundQuit:= tempgBackgroundQuit;
- gForceQuit:= tempgForceQuit;
- gFillMemory:= tempgFillMemory;
- gIntegration := temp; #To reset the integration global - KTA
-
- return(returnval);
-
- end; # Scrapbook()
-